import 'package:flutter/material.dart';
import 'package:hotfil_pub_web/widgets/my_theme.dart';

class BgInput extends TextFormField {
  String? hintText = '';
  bool obscureText = false;
  FormFieldValidator<String>? validator;
  FormFieldSetter<String>? onSaved;
  TextInputType keyboardType = TextInputType.text;
  String initialValue;

  BgInput(
      {this.initialValue = '',
      this.hintText,
      this.onSaved,
      this.obscureText = false,
      this.keyboardType = TextInputType.text,
      this.validator})
      : super(
            initialValue: initialValue,
            obscureText: obscureText,
            keyboardType: keyboardType,
            maxLength: 20,
            cursorRadius: const Radius.circular(30),
            cursorColor: Colors.black,
            decoration: InputDecoration(
              filled: true,
              fillColor: MyTheme.inputBackgroundColor,
              hintStyle: TextStyle(color: MyTheme.hintTextColor, fontSize: 14),
              border: InputBorder.none,
              contentPadding: EdgeInsets.symmetric(horizontal: 18.0),
              hintText: hintText,
              counterText: '',

              //隐藏下划线,

              enabledBorder: OutlineInputBorder(
                  borderRadius: const BorderRadius.all(Radius.circular(22)),
                  borderSide: BorderSide(
                    width: 0,
                    color: MyTheme.inputBackgroundColor,
                  )),
              focusedBorder: OutlineInputBorder(
                  borderRadius: const BorderRadius.all(Radius.circular(22)),
                  borderSide: BorderSide(
                    width: 0,
                    color: MyTheme.inputBackgroundColor,
                  )),
            ),
            validator: validator,
            onSaved: onSaved);
}
